package com.example.jms;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import com.example.util.Constants;


@Component
public class JmsListener implements ApplicationListener<ContextRefreshedEvent>{
	private static Logger logger=LoggerFactory.getLogger(JmsListener.class);
    @Autowired
	CamelContext camelContext;
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		try {
			logger.info("jms listener start ......");
			camelContext.addRoutes(new RouteBuilder(){

				@Override
				public void configure() throws Exception {
				//	from(Constants.telecomJMS.value+"?concurrentConsumers=20").to("bean:telecomSend?method=send").routeId("中国电信发送消息");
					
				}
				
			});
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	

}
